<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Admin_Merchmanagement_Values extends Controller_Admin_Template {
	
	public function action_add() {
		$attribute_id = $this->request->param('id');
		$value = new Model_Value();
		$value->values($_POST);
		$value->attribute_id = $attribute_id;
		$value->save();
		
		$attribute = new Model_Attribute($attribute_id);
		$category_id = $attribute->category->id;
		
		$this->request->redirect('admin/merchmanagement/attributes/'.$category_id);
	}
	
	public function action_delete() {
		$value_id = $this->request->param('id');
		$value = new Model_Value($value_id);
		$category_id = $value->attribute->category->id;
		$value->delete();
		
		$this->request->redirect('admin/merchmanagement/attributes/'.$category_id);
	}
}